package com.padakeji.android.pworks.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.widget.EditText;

import com.padakeji.android.pworks.R;

/**
 * Created by atanl on 2015/9/29.
 */
public class IconEditText extends EditText {

    public interface OnDrawableTopClickListener {
        void onDrawableTopClick();
    }

    public interface OnDrawableRightClickListener {
        void onDrawableRightClick();
    }

    public interface OnDrawableBottomClickListener {
        void onDrawableBottomClick();
    }

    public interface OnDrawableLeftClickListener {
        void onDrawableLeftClick();
    }

    private float drawableTopWidth;
    private float drawableTopHeight;
    private float drawableRightWidth;
    private float drawableRightHeight;
    private float drawableBottomWidth;
    private float drawableBottomHeight;
    private float drawableLeftWidth;
    private float drawableLeftHeight;


    public IconEditText(Context context) {
        super(context);
    }

    public IconEditText(Context context, AttributeSet attrs) {
        this(context, attrs, R.attr.IconEditTextStyle);
    }

    public IconEditText(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.IconEditText, defStyleAttr, R.style.IconEditTextDefaultStyle);

        drawableTopWidth = a.getFloat(R.styleable.IconEditText_drawableTopWidth, 0);
        drawableTopHeight = a.getFloat(R.styleable.IconEditText_drawableTopHeight, 0);
        drawableRightWidth = a.getFloat(R.styleable.IconEditText_drawableRightWidth, 0);
        drawableRightHeight = a.getFloat(R.styleable.IconEditText_drawableRightHeight, 0);
        drawableBottomWidth = a.getFloat(R.styleable.IconEditText_drawableBottomWidth, 0);
        drawableBottomHeight = a.getFloat(R.styleable.IconEditText_drawableBottomHeight, 0);
        drawableLeftWidth = a.getFloat(R.styleable.IconEditText_drawableLeftWidth, 0);
        drawableLeftHeight = a.getFloat(R.styleable.IconEditText_drawableLeftHeight, 0);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Drawable[] ds = getCompoundDrawables();

    }
}
